package com.example.administrator.ygddriver.order.specific;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.widget.LinearLayout;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.administrator.ygddriver.R;

import java.util.List;

public class SpecificAdapter extends BaseQuickAdapter<PickUpInfoRequestBean.ResultBean, BaseViewHolder> {
    public SpecificAdapter(int layoutResId, @Nullable List<PickUpInfoRequestBean.ResultBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PickUpInfoRequestBean.ResultBean item) {
        LinearLayout linearLayout = helper.getView(R.id.item_activity_specific_ll);
        if (item.getCostomerStatus().equals("2")) {
            linearLayout.setBackgroundColor(Color.parseColor("#ff0000"));
        } else if (item.getCostomerStatus().equals("3")) {
            linearLayout.setBackgroundColor(Color.parseColor("#1bc200"));
        }
        helper.setText(R.id.item_activity_specific_costomer_name_tv, item.getCostomerName());
        helper.setText(R.id.item_activity_specific_costomer_number_tv, item.getCostomerPhone());
        helper.setText(R.id.item_activity_specific_costomer_number_tv, "共"+item.getCostomerNumber()+"件");
        RecyclerView mRv = helper.getView(R.id.item_activity_specific_rv);
        SpecificIntoAdapter mSpecificIntoAdapter = new SpecificIntoAdapter(R.layout.item_specific_into, item.getCostomerWaybill());
        mRv.setLayoutManager(new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL));
        mRv.setAdapter(mSpecificIntoAdapter);
    }
}
